/*
 * @Author: wangshuixin 2412658453@qq.com
 * @Date: 2024-11-15 17:07:17
 * @LastEditors: wangshuixin 2412658453@qq.com
 * @LastEditTime: 2024-12-10 09:06:25
 * @FilePath: \sr_system_manager_ui\src\api\resultsManagements\AcademicWorkApi.ts
 * @Description: 学术著作模块Api
 */
import request from '@/utils/request'
import { WorksPageReqDTO } from './types'
import type { AcademicWorkListResp } from '@/types/resultsManagement'
import type { PaginationQueryUniteRespDTO, AppStateChangeRespDTO } from '@/types/index'

// 学术著作 分页查询
export function getAcademicWorkListApi(params: WorksPageReqDTO) {
  return request<PaginationQueryUniteRespDTO<AcademicWorkListResp>>({
    url: `/achv/works/page`,
    method: 'post',
    data: params
  })
}

// 获取 学术著作 详情
export function getAcademicWorkDetailApi(params) { 
  return request<AcademicWorkListResp>({
    url: `/achv/works/detail`,
    method: 'post',
    data: params
  })
}

// 创建 学术著作 详情
export function createAcademicWorkDetailApi(params) {
  return request<AppStateChangeRespDTO>({
    url: `/achv/works/create`,
    method: 'post',
    data: params
  })
}

// 更新 学术著作 详情
export function updateAcademicWorkDetailApi(params) {
  return request<AppStateChangeRespDTO>({
    url: `/achv/works/update`,
    method: 'post',
    data: params
  })
}

/**
 * 导出 学术著作
 * @param {number} unStatus 不包含状态
 * @param {string} createdBy 创建人id
 * @param {string} departmentId 部门id
 * @param {string} idList 导出id
*/
export function exportAcademicWorkApi(params: { unStatus?: number, createdBy?: string, departmentId?: string, idList?: string[] }) {
  return request({
    url: `/achv/works/export`,
    method: 'post',
    responseType: 'blob',
    data: params
  })
}